"""
@description: Preprocessor class for preprocessing data.
@author: Zzay
@create: 2022/07/08
"""
import cv2


class SimplePreprocessor:
    """
    Data preprocessor.
    """

    def __init__(self, width, height, interpolation=cv2.INTER_AREA):
        """
        Store the target image's related information.
        :param width: Width
        :param height: Height
        :param interpolation: Interpolation
        """
        self.width = width
        self.height = height
        self.interpolation = interpolation

    def preprocess(self, image):
        """
        Resize the image to a fixed size, ignoring the aspect ratio.
        :param image: Image to preprocess
        :return: Resize the input image
        """
        return cv2.resize(src=image,
                          dsize=(self.width, self.height),
                          interpolation=self.interpolation)
